/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.gracefulmm.dealImage;

/**
 *
 * @author wenbo
 */

import java.util.concurrent.ArrayBlockingQueue;
import java.util.concurrent.ExecutorService;
import java.util.concurrent.ThreadPoolExecutor;
import java.util.concurrent.TimeUnit;

public class ImageExecutorService {
	
	private static final class ExecutorSerivceBuild{
		//根据服务器CPU的个数来设置任务数
		private static final ExecutorService INSTANCE = new ThreadPoolExecutor(Runtime.getRuntime().availableProcessors(), 800,
                60L, TimeUnit.SECONDS,new ArrayBlockingQueue<Runnable>(500));
	}
	
	private ImageExecutorService(){
		
	}
	
	public static ExecutorService getImageExecutorServiceInstance(){
		return ExecutorSerivceBuild.INSTANCE;
	}
}

